package com.jiao.Controller;

import com.jiao.domain.DTO.UserDto;
import com.jiao.domain.Result;
import com.jiao.domain.VO.BlogUserLoginVo;
import com.jiao.service.BlogLoginService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Blog")
public class BlogLoginController {
    @Autowired
    private BlogLoginService blogLoginService;

    /*
    * 在刚进入系统界面时，会显示部分个人信息，定义UserInfoVo存该数据
    * */
    @PostMapping("/login")
    public Result<BlogUserLoginVo> login(@RequestBody UserDto userDto){
        return blogLoginService.login(userDto);
    }

    @PostMapping("/logout")
    public Result<String> logout(){
        return blogLoginService.logout();
    }
}